//
// Created by Administrator on 2022/1/2 0002.
//
#include <iostream>
#include "t_mix_type.h"

//测试结构的混合类型
void test_mix_type(){
    using namespace std;

    struct antarctica_years_end{
        int year;
    };

    antarctica_years_end s01,s02,s03;
    s01.year = 1998;
    antarctica_years_end *pa = &s02;
    pa->year = 1999;
    //连续的区域
    antarctica_years_end trio[3];
    trio[0].year = 2003;
//    一个是类型指针方式，一个是取值方式
    cout<<trio[0].year<<endl<<"like poiunter same as :"<<trio->year<<endl;

    //不连续的区域
    const antarctica_years_end *arp[3] = {&s01,&s02,&s03};
    cout<<arp[1]->year<<endl;

    const antarctica_years_end **ppa = arp;//first addr；第一个元素的地址，同：&arp[0]
    auto ppb = arp;

    cout<<(*ppa)->year<<endl;//1998
    cout<<(*(ppb+1))->year<<"same as:"<<(*(*(ppb+1))).year<<endl;//1999

    const antarctica_years_end*(*ppc)[3] = &arp;//数组的地址
    cout<<(*(*ppc+1))->year<<"same as:"<<(*(*(*ppc+1))).year<<endl;

}